﻿# 仅抓 glass：纯数字序列号
# 获取所有已连接的设备
$devices = adb devices | Where-Object { $_ -match '^(\S+)\s+device$' -and $_ -notmatch 'emulator' } | ForEach-Object { $Matches[1] }

Write-Host "所有已连接的设备：$devices"

# 筛选纯数字序列号的设备（glass设备）
$glassDevices = $devices | Where-Object { $_ -match '^\d+$' }

Write-Host "筛选出的 glass 设备：$glassDevices"

if (-not $glassDevices -or $glassDevices.Length -eq 0) { Write-Error "❌ 找不到纯数字序列号的设备（glass）"; exit 1 }

$dev = $glassDevices
Write-Host "✅ glass 设备 → $dev"

# 使用Windows批处理文件运行gradle命令
./gradlew.bat :glass-app:installDebug
adb -s $dev shell am start -n com.maint.g/.MainActivity